#!/bin/bash

cd src

ARGS="-march=i686 $(wx-config --cxxflags) -DUSE_WX_EXTENSIONS"
IPATH="-I. -Iinclude -Ilibs"

echo Compiling collection.cpp ...
g++ ${ARGS} ${IPATH} collection.cpp -c

echo Compiling amule-emc.cpp ...
g++ ${ARGS} amule-emc.cpp -c

echo Compiling CFile.cpp
g++ ${ARGS} ${IPATH} CFile.cpp -c

echo Compiling SafeFile.cpp
g++ ${ARGS} ${IPATH} SafeFile.cpp -c

echo Compiling FileFunctions.cpp
g++ ${ARGS} ${IPATH} FileFunctions.cpp -c

echo Compiling Tag.cpp
g++ ${ARGS} ${IPATH} Tag.cpp -c

echo Linking ...
g++ amule-emc.o collection.o CFile.o FileFunctions.o SafeFile.o Tag.o `wx-config --libs` -o amule-emc
strip --strip-unneeded amule-emc
echo Compilation finished
cp amule-emc ../amule-emc